/*
 * @Descripttion: 修改自身信息
 * @version: 1.0
 * @Author: 自由如风
 * @Date: 2021-04-27 17:25:28
 * @LastEditors: 自由如风
 * @LastEditTime: 2021-04-28 07:22:45
 */
const DB = require('../../lib/DB')
const { Success } = require('../../lib/Response')
module.exports = async function (ctx, next) {
    const { sex, pwd } = ctx.request.body;
    const user = await DB.models.user.findByPk(ctx.session.user.id)
    user.sex = sex;
    user.pwd = pwd;
    await user.save();
    ctx.body = new Success(user.toJSON())
    await next();
}
